import { compilrToFunction } from "./compile/index";
import { initState } from "./initState";

export function initMixin(Vue) {
  Vue.prototype._init = function (options) {
    let vm = this;
    vm.$options = options;
    // 初始化状态
    initState(vm);
    // 渲染模板
    const el = vm.$options.el;
    if (el) {
      vm.$mount(el);
    }
  };
  Vue.prototype.$mount = function (el) {
    let vm = this;
    let options = vm.$options;
    el = document.querySelector(el);
    if (!options.render) {
      const template = options.template;
      if (!template && el) {
        el = el.outerHTML;
        const ast = compilrToFunction(el)
      }
    }
  };
}

